package com.qf.edu.dao.impl;

import com.qf.edu.dao.SetNurse;
import com.qf.edu.entity.Users;
import com.qf.edu.utils.DBUtils;
import org.apache.commons.dbutils.QueryRunner;
import org.apache.commons.dbutils.handlers.BeanListHandler;

import java.sql.SQLException;
import java.util.List;

/**
 * @author:huayuzhuo
 * @email:2798866329@qq.com
 * @desc:个人信息接口实现类
 * @datatime: 2022/5/28 15:55
 */
public class SetNurseImpl implements SetNurse {
    @Override
    public List<Users> setNurse(String name, String password) {
        QueryRunner queryRunner = new QueryRunner(DBUtils.getDataSource());
        String sql = "SELECT * FROM users WHERE `name` = ? and `password` = ?";
        try {
            List<Users> query = queryRunner.query(sql, new BeanListHandler<>(Users.class), name,password);
            return query;
        } catch (SQLException e) {
            e.printStackTrace();
        }
        return null;
    }
}
